﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Carbon.Web.Forms.jQueryForms
{
    public interface IListEditorItem
    {
        bool Selected
        {
            get;
            set;
        }

        Object Data
        {
            get;
        }
    }

    [Serializable]
    public class ListEditorItem<T> : IListEditorItem
    {
        private bool m_Selected = default(bool);
        public bool Selected
        {
            get
            {
                return m_Selected;
            }
            set
            {
                m_Selected = value;
            }
        }

        private T m_Model = default(T);
        public T Model
        {
            get
            {
                return m_Model;
            }
            set
            {
                m_Model = value;
            }
        }

        public Object Data
        {
            get
            {
                return m_Model;
            }
        }

        public virtual ListEditorItem<T> Clone()
        {
            return new ListEditorItem<T>()
            {
                Selected = this.Selected,
                Model = this.Model
            };
        }
    }
}
